package com.otitan.la.forest.system.controller;

import com.otitan.la.forest.system.dto.UserOrgDTO;
import com.otitan.la.forest.system.service.UserOrgService;
import com.otitan.webapp.framework.basepro.model.DataResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 用户组织机构 Controller
 *
 * @author jiacs
 * @email xxx
 * @date 2020-09-15 10:34:19
 */
@Slf4j
@Api(tags = "用户组织机构关系API")
@RestController
@RequestMapping("/user/org")
public class UserOrgController {

    @Autowired
    private UserOrgService userOrgService;


    @ApiOperation(value = "新增")
    @PostMapping()
    public DataResult add(@Valid @RequestBody UserOrgDTO userOrgDTO, BindingResult bindingResult) {
        return userOrgService.add(userOrgDTO, bindingResult);
    }

    @ApiOperation(value = "批量删除")
    @DeleteMapping("/batchDelete")
    public DataResult batchDelete(@RequestBody UserOrgDTO userOrgDTO) {
        return userOrgService.batchDelete(userOrgDTO);
    }
}
